<?
require("session.php");
require("header.php");
?>
<script src="js/jquery-1.9.1.min.js"></script>
<link href="css/home.css" type="text/css" rel="stylesheet" />
<style>
	.input_text { width:260px; height:23px; border:#99cc33 1px solid; font-size:15px; font-family:arial; color:#ff3300}
</style>
</head>

	<div style="width:100%;background:#efefef;border-top:#ddd 5px solid; border-bottom:#ddd 5px solid">
		<div style="width:100%;text-align:center; background:white; margin:auto">
			<table width=99% cellpadding=3 cellspacing=1 bgcolor="#dddddd">
				<tr bgcolor=white><td colspan=2 align=left><font style="color:gray; font-size:15px">【<b>请说明一下取消定单的原因</b>】</font></td></tr>
				<tr bgcolor="white">
					<td align=right>取消原因</td><td align=left><select class="input_text" id="cancel_reason"><option value=''>-为什么-</option><option value='1'>定单填写错误</option><option value='2'>暂时不想买了</option><option value='3'>配送延时问题</option><option value='4'>其它服务问题</option></select></td>
				</tr>
				<tr bgcolor="white">
					<td align=right  width=20%>备注说明</td><td align=left width=70%><textarea class="input_text" id="cancel_desc" style="width:260px; height:90px" rows=5></textarea></td>
				</tr>
				<tr bgcolor="white">
					<td align=right>&nbsp;</td><td align=left>	<a href="javascript:save()"><img src="images/save_button.jpg" id="btn_save" border=0  style="vertical-align:middle"></a>　<a href="javascript:parent.closeDlg()" class="gray">关闭本窗口</a></td>
				</tr>
			</table>
			<font color="green">(亲！您有任何疑问，都可以咨询客服：400-082-8099)</font>
			<br><br>
		</div>
	
	<script>

		function save() {
			if( $("#cancel_reason").val() == "" || $("#address").val() == "") {
				alert("请选择您取消定单的原因！");
				return false;
			}
			var params = {'cancel_reason':$("#cancel_reason").val(), 'cancel_desc':$("#cancel_desc").val()}
			if(confirm("确认要取消您的定单吗？")) {
				$("#btn_save").attr("src", "images/saving_button.jpg");
				$.post("order_query.php?action=cancel_order&id=<?echo $_GET['order_id']?>", params, function(data) {
					if(data == "ok") {
						alert("您的定单已成功申请取消！");
						parent.location.reload();
					}
				});
			}
		}
		

		$(function() {
			$.get("order_query.php?action=get_by_id&id=<?echo $_GET['order_id']?>", function(data){
				eval("var row = "+data);
				$('#cancel_reason').val(row['cancel_reason']);
				$('#cancel_desc').val(row['cancel_desc']);
			});
		});
	</script>
</body>
</html>